
/****** Object:  Table [dbo].[purchase]    Script Date: 06/10/2010 15:00:05 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[purchase](
	[cCompanyID] [varchar](10) NOT NULL,
	[cPCCode] [varchar](10) NULL,
	[cTranNo] [varchar](15) NOT NULL,
	[dDate] [datetime] NOT NULL,
	[cReturnType] [varchar](20) NULL,
	[cTaxType] [varchar](15) NULL,
	[nTaxRate] [numeric](20, 2) NOT NULL,
	[cCode] [varchar](15) NULL,
	[cName] [varchar](100) NULL,
	[cAddress] [varchar](200) NULL,
	[cContact] [varchar](50) NULL,
	[cTerms] [varchar](15) NULL,
	[cRemarks] [varchar](500) NULL,
	[dReceived] [datetime] NULL,
	[cReceivedBy] [varchar](50) NULL,
	[nGross] [numeric](20, 2) NOT NULL,
	[nReturn] [numeric](20, 2) NOT NULL,
	[nPaid] [numeric](20, 2) NOT NULL,
	[nCredit] [numeric](20, 2) NOT NULL,
	[nDebit] [numeric](20, 2) NOT NULL,
	[nBalance] [numeric](20, 2) NOT NULL,
	[nEWT] [numeric](20, 2) NOT NULL,
	[lPosted] [bit] NOT NULL,
	[lClosed] [bit] NOT NULL,
	[lCancelled] [bit] NOT NULL,
	[lApproved] [bit] NOT NULL,
	[cApprovedBy] [varchar](50) NULL,
	[lPrintPosted] [bit] NOT NULL,
	[cPullOutNo] [varchar](20) NULL,
	[nTaxCode] [varchar](20) NULL,
	[nVAT] [numeric](18, 2) NULL,
	[nEWTRate] [numeric](18, 2) NULL,
	[nTaxableBase] [numeric](18, 2) NULL,
	[cSuppInvNo] [varchar](15) NULL,
 CONSTRAINT [PK_PURCHASE] PRIMARY KEY CLUSTERED 
(
	[cCompanyID] ASC,
	[cTranNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nTaxRate]  DEFAULT (0) FOR [nTaxRate]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nGross]  DEFAULT (0) FOR [nGross]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nReturn]  DEFAULT (0) FOR [nReturn]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nPaid]  DEFAULT (0) FOR [nPaid]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nCredit]  DEFAULT (0) FOR [nCredit]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nDebit]  DEFAULT (0) FOR [nDebit]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nBalance]  DEFAULT (0) FOR [nBalance]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nEWT]  DEFAULT (0) FOR [nEWT]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_lPosted]  DEFAULT (0) FOR [lPosted]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_lClosed]  DEFAULT (0) FOR [lClosed]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_lDeleted]  DEFAULT (0) FOR [lCancelled]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_lApproved]  DEFAULT (0) FOR [lApproved]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_lPrintPosted]  DEFAULT (0) FOR [lPrintPosted]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nVAT]  DEFAULT ((0)) FOR [nVAT]
GO

ALTER TABLE [dbo].[purchase] ADD  CONSTRAINT [DF_purchase_nTaxableBase]  DEFAULT ((0)) FOR [nTaxableBase]
GO





SELECT * FROM purchase